package com.zbkj.crmeb.task.tools;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

import com.xxl.job.core.handler.annotation.XxlJob;
import com.zbkj.crmeb.tools.service.MoneyExchangeService;

import lombok.extern.slf4j.Slf4j;



/**
 * 定时获取汇率数据
 * @author daigb
 * @date:  2021-12-17 15:38
 */
@Slf4j
@Component
@Configuration
@EnableScheduling
public class MoneyExchangeTask {
    @Autowired
    MoneyExchangeService moneyExchangeService;




    /**
     * 每半小时更新汇率
     */
    @XxlJob("moneyExchangeTask")
    public void updateExchange(){
        try {
            moneyExchangeService.syncMoneyExchangeData();
        }catch (Exception e){
            log.error("OrderTakeByUser.task error ! e: " ,e);
        }

    }


}
